Parent-child relationships are very common in relational database schemas. For example, a database schema might indicate a relationship between a manager (parent) and one or more employees (children) who are subordinate to that manager. For another example, a database schema might indicate a relationship between a purchase order (parent) and one or more lines (children) that are a part of that purchase order. Data that contains such parent-child relationships is called hierarchical data since the parent-child relationships form a hierarchy.
When applications need to save relational data to a database the key of the parent record needs to be known in advance of saving a child record that is bound to it. This requires the application to query the database for each parent record it encounters to determine the corresponding key before writing the child record. In addition, if there is a third level in the hierarchy, the second level record needs to be saved before the new key can be known and applied to the third level, and so on.
This leads to an inefficient use of network and database resources as each object in a row is sent to the database one at a time, recursively though the data hierarchy. For example, in a data set that has 3 levels of data with each parent having 10 children, this results in 1110 (10+100+1000) individual calls to the database.